import {AxiosRequestConfig , AxiosResponse} from 'axios'

interface HyAxiosRequestConfig extends AxiosRequestConfig {
  headers:{}
}

//定义拦截器接口
export interface HYRequestInterceptors<T = AxiosResponse> {
  //请求拦截
  requestInterceptor?: (config: AxiosRequestConfig) => AxiosRequestConfig
  requestInterceptorCatch?: (error: any) => any
  //响应拦截
  responseInterceptor?: (res: T) => T
  responseInterceptorCatch?: (error: any) => any
}

//修改官方类型接口，增加一些新的类型拓展
export interface HYRequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptors?:HYRequestInterceptors<T>
  showLoading?: boolean
}
